package com.liao.badminton.dto;

import com.liao.badminton.code.BaseField;
import com.liao.badminton.code.validation.Delete;
import com.liao.badminton.code.validation.Insert;
import com.liao.badminton.code.validation.Update;
import io.swagger.annotations.ApiModelProperty;
import com.liao.badminton.entity.FileShard;
import javax.validation.constraints.NotNull;
import java.util.List;
import lombok.Data;
import com.liao.badminton.code.validation.FindDetail;
import java.lang.String;
import java.util.Date;

/**
* @author liaocheng
* @date 2024-11-01
* description:文件
*/
@Data
public class FileShardDto extends BaseField {

    @ApiModelProperty(value = "主键id")
    @NotNull(message = "主键id不能为空",groups = {Update.class, FindDetail.class})
    private Long id;

    @ApiModelProperty(value = "相对路径")
    private String path;

    @ApiModelProperty(value = "文件名")
    private String name;

    @ApiModelProperty(value = "后缀")
    private String suffix;

    @ApiModelProperty(value = "大小|字节B")
    private Integer size;

    @ApiModelProperty(value = "已上传分片")
    private Integer shardIndex;

    @ApiModelProperty(value = "分片大小|B")
    private Integer shardSize;

    @ApiModelProperty(value = "分片总数")
    private Integer shardTotal;

    @ApiModelProperty(value = "文件标识")
    private String fileMd;

    @NotNull(message = "主键id不能为空",groups = {Delete.class})
    private List<Long> delIds;  //批量删除ids
    private String fileBs64;
    public FileShard invertEntity(){
        FileShard dto = new FileShard();
        BaseField.invert(this, dto);
        dto.setId(this.getId());
        dto.setPath(this.getPath());
        dto.setName(this.getName());
        dto.setSuffix(this.getSuffix());
        dto.setSize(this.getSize());
        dto.setShardIndex(this.getShardIndex());
        dto.setShardSize(this.getShardSize());
        dto.setShardTotal(this.getShardTotal());
        dto.setFileMd(this.getFileMd());
        return dto;
    }

}
